#include<iostream>

using namespace std;

class AbstractCalculator {
public:
	AbstractCalculator() : m_num1(0), m_num2(0) {

	}

	virtual int getResult() {
		return 0;
	}

	int m_num1;
	int m_num2;
};

class AddCalculator : public AbstractCalculator {
public:
	int getResult() {
		return m_num1 + m_num2;
	}
};

class SubCalculator : public AbstractCalculator {
public:
	int getResult() {
		return m_num1 - m_num2;
	}
};

void test01()
{
	AbstractCalculator* abs = new AddCalculator;
	abs->m_num1 = 100;
	abs->m_num2 = 50;
	cout << abs->m_num1 << " + " << abs->m_num2 << " = " << abs->getResult() << endl;
	delete abs;

	abs = new SubCalculator;
	abs->m_num1 = 100;
	abs->m_num2 = 50;
	cout << abs->m_num1 << " - " << abs->m_num2 << " = " << abs->getResult() << endl;
	delete abs;
}

int main(void)
{
	test01();
	return 0;
}